import request from '@/utils/request'

export function getAll(params,type) {
  return request({
    url: type+'/all',
    method: 'get',
    params
  })
}

export function delOne(index,type){
  return request({
    url: type+'/deleteOne',
    method:'post',
    params:{
      index: index
    }
  })
}

export function updateOne(form,type){
  var user = JSON.stringify(form);
  return request({
    url: type+'/updateOne',
    method:'post',
    data:user,
    headers: {
      "Content-Type":"application/json"
    }
  })
}

export function queryOne(formInline,type){
  var user = JSON.stringify(formInline);
  return request({
    url: type+'/queryOne',
    method:'post',
    data:user,
    headers:{
      "Content-Type":"application/json"
    }
  })
}

export function addOne(form,type){
  var user = JSON.stringify(form);
  return request({
    url: type+'/insertOne',
    method:'post',
    data:user,
    headers: {
      "Content-Type":"application/json"
    }
  })
}